#define _CRT_SECURE_NO_WARNINGS	
#pragma once
#include<iostream>

template<class K>
struct List_Node
{
	typedef struct List_Node<K> SALF;
	K& _key;
	SALF* _prev;
	SALF* _next;

	List_Node(const K& key= K())
		:_key(key)
		,_prev(nullptr)
		,_next(nullptr)
	{}
};

template<class K>
struct List_Iterator
{
	typedef struct List_Node<K> Node;
	typedef struct List_Iterator<K> SALF;
	Node* _pos;
	List_Iterator(Node* pos)
		:_pos(pos)
	{}
	K& operator* ()const
	{
		return _pos->_key;
	}
};

template<class K>
class List
{
public:
	typedef struct List_Node<K> Node;
	typedef struct List_Iterator<K> Iterator;
	Iterator begin()
	{
		return _head->_next;
	}
	Iterator end()
	{
		return _head;
	}
	List()
	{
		_head = new Node();
		_head->_next = _head;
		_head->_prev = _head;
		_size = 0;
	}
	void push_back(const K& key)
	{
		Node* newnode = new Node(key);
		Node* Prev = _head->_prev;
		newnode->_prev = Prev;
		newnode->_next = _head;
		_head->_prev = newnode;
		Prev->_next = newnode;
		_size++
	}
	void Insert(const K& key)
	{

	}
	//βɾ
	void pop_back()
	{
		Node* Prev = _head->_prev->prev;
		Node* pos = _head->_prev;
		_head->_prev = Prev;
		Prev->_next= _head;
		delete pos;
		_size--;
	}
private:
	Node* _head;
	size_t _size;
};